<?php

namespace Modules\SmallApi\Http\Controllers;


use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\SmallApi\Service\CouponshService;

class CouponshController extends BaseController
{	

	/**
	 * 	商户APP扫码用户提供的二维码获得参数 ， 并携带参数请求优惠券、用户信息
	 *	hinq 2019 10 24 
	 *
	 **/
	public function coupon_detail( Request $request ){

		$ticket_num = (string) $request->get('ticket_num');
		$arr_list = CouponshService::coupon_detail( (string) $ticket_num );
		return response_json( $arr_list );
	}


	/**
	 *	使用扫码扫出来的优惠券
	 *	hinq 2019 10 24
	 *
	 ***/
	public function coupon_use( Request $request ){
		$nId = $request->get('id');
		$arr_list = CouponshService::coupon_use( (int) $nId );
		return response_json( $arr_list );
	}


	/**
	 *	商户获取已在该商户商用的优惠券列表
	 *	hinq 2019 10 24
	 *
	 **/
	public function use_coupon_list( Request $request ){
		$arr_search = (array) $request->all();
		$arr_list = CouponshService::use_coupon_list( (array) $arr_search );
		return response_json( $arr_list );
	}


	/**
	 *	统计当前商户下已购买商品用户的订单统计
	 *	hinq 2019 10 25
	 *	【该功能未全部开发完】
	 **/
	public function user_to_order_count( Request $request ){
		$arr_search = (array) $request->all();
		$arr_list = CouponshService::user_to_order_count( (array) $arr_search );
		return response_json( $arr_list );
	}

}